package com.bjpowernode.controller;

import com.bjpowernode.common.result.Result;
import com.bjpowernode.entity.TClueRemark;
import com.bjpowernode.entity.query.ClueRemarkQuery;
import com.bjpowernode.service.ClueRemarkService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

@RequiredArgsConstructor
@RestController
public class ClueRemarkController {

    private final ClueRemarkService clueRemarkService;


    /**
     * 保存线索跟踪记录
     */
    @PostMapping("/api/clue/remark")
    public Result saveClueRemark(@RequestBody ClueRemarkQuery clueRemarkQuery) {
        int flag = clueRemarkService.saveClueRemark(clueRemarkQuery);
        if (flag > 0) {
            return Result.OK();
        } else {
            return Result.FAIL("保存失败");
        }
    }

    /**
     * 获取线索跟踪记录
     */
    @GetMapping("/api/clue/{id}/remarks")
    public Result getClueRemarks( Integer current, @PathVariable("id") Integer clueId) {
        return Result.OK(clueRemarkService.getClueRemarks(current, clueId));
    }


}
